import {login,Logininformation,Homepagestatistics} from '@/api/http'
const state = {
//登录信息
loginfromation:{},
pagestatistics:{}
};
//登录信息
const mutations = {
  LOGININFROMATION(state,loginfromation){
    state.loginfromation = loginfromation
  },
//首页信息
HOMEPAGESTATISTICS(state,pagestatistics){
  state.pagestatistics = pagestatistics
}
}
const actions ={
  //登录
async getlogin({commit},{email,password}){
let request = await login({email,password})
if(request.status==200){
  localStorage.setItem('shuchotaitoken',request.data.access_token)
}
},
//登录信息
async getLogininformation({commit}){
 const request = await Logininformation()
 if(request.status==200){
  commit('LOGININFROMATION',request.data)
 }
},
//首页信息
async getHomepagestatistics({commit}){
let request = await Homepagestatistics()
console.log(request)
if(request.status==200){
  commit('HOMEPAGESTATISTICS',request.data)
}
}
}
const getters ={

}
export default{
  state,
  mutations,
  actions,
  getters
}